<template>
    <el-dialog title="范本列表" width="500" :visible.sync="dialogDraftList" :fullscreen="false" >
        <div class="draftList">
           <avue-crud :data="data" :option="option">
               <template slot-scope="scope" slot="menu">
                    <el-button type="text" :size="size"  @click="useDraft(scope)">使用</el-button>
               </template>
           </avue-crud>
        </div>
    </el-dialog>
</template>

<script>
    import {getAction, putAction, postAction, deleteAction} from '@/api/manage'
    export default {
        name: 'draftList',
        props: {
            visible: {
                type: Boolean,
                default: function () {
                    return false
                }
            },
           
        },
        computed: {
            dialogDraftList: {
                get() {
                    return this.visible
                },
                set(val) {
                    this.$emit('update:visible', val)
                }
            }
        },
        data() {
            return {
                data: [],
                option:{
                    title:'表格的标题',
                    page:false,
                    align:'center',
                    menuAlign:'center',
                    addBtn:false,
                    refreshBtn:false,
                    columnBtn:false,
                    editBtn:false,
                    delBtn:false,
                    column:[
                        {
                            label:'范本名称',
                            prop:'draftName'
                        },{
                            label: "创建时间",
                            prop: "createTime",
                            type: "date",
                            format: "yyyy-MM-dd",
                            valueFormat: "yyyy-MM-dd",
                        }
                    ]
                }
            }
        },
        created() {

        },
        methods: {
            getList(id){
                getAction('/api/sdt-flow/flowable/form/list-draft',{procDefId:id,dataType:'template'}).then(res => {
                    let data = res.data.data.records
                    this.data = data
                })
            },
            useDraft(scope){
                console.log(scope,'scope--->>')
                this.$emit('templateSelect',scope.row)
                this.dialogDraftList = false
            }
        }
    }
</script>

<style lang="scss" scoped>
  
</style>